<template>
  <div class="store">
    <el-input
        v-if="row.outBoundName"
        v-model="value"
        style="width: 100px; margin-right: 10px"
        @change="onChange"/>
  </div>
</template>

<script>
import { getStoreNumList } from './api'

export default {
  props: {
    row: {
      type: Object,
      default: () => {
      }
    },
    warehouseId: {
      default: null,
      type: Number
    },
  },
  data () {
    return {
      value: 0,
      outBoundNumMax: 0
    }
  },
  watch: {
    row: {
      handler (arg) {
        console.log('this1----arg', arg)
        // if (arg.id) {
        //   this.value = arg.outBoundNum
        // }else{
        //   this.value = arg.outBoundNum
        // }
        this.value = arg.outBoundNum
        this.onGetStoreNum(arg)
      },
      immediate: true,
      deep: true
    }
  },
  methods: {
    onGetStoreNum (arg) {
      this.outBoundNumMax = arg.storeNum
    },
    onChange (val) {
      console.log(23, val, this.outBoundNumMax)
      if (val > this.outBoundNumMax) {
        this.value = this.outBoundNumMax
      }
      this.$emit('input', val * 1)
    }
  }
}
</script>
<style lang="scss">
.store {
  display: flex;
  align-items: center;
}
</style>
